package com.example.black.myapplication.androidframwork;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ScrollView;

import com.example.black.myapplication.R;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MainTonchEventActivity extends AppCompatActivity {
    private List<Integer> arrays = new ArrayList<>(
            Arrays.asList(
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    1,
                    2,
                    3,
                    4,
                    5,
                    6
            )
    );
    private ListView lv;

    private ArrayAdapter<Integer> adapter;
    private MyScrollView scrollView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_tonch_event);
        initView();
    }


    private void initView() {
        lv = findViewById(R.id.lv);
        scrollView = findViewById(R.id.scrollView);
        adapter = new ArrayAdapter<>(
                this,android.R.layout.simple_list_item_1
                ,android.R.id.text1
                ,arrays
        );
        scrollView.setListView(lv);
        lv.setAdapter(adapter);
//        lv.setOnTouchListener((v, event) -> {
//           // lv.getParent().requestDisallowInterceptTouchEvent(true);
//            lv.requestDisallowInterceptTouchEvent(true);
//            return false;
//        });
    }
}
